import '../../style/sign.less';
import React, {Component} from 'react'
import {inject, observer} from 'mobx-react';
import { withRouter, Route } from 'react-router-dom';
import { Tools } from 'weaver-mobile';
import Header from './Header';
import Content from './Content';
import Footer from './Footer';
import CanNotAccess from '../CanNotAccess';

const getLabel = Tools.getLabel;

@inject('signStore')
@withRouter
@observer
export default class Sign extends Component {
  componentDidMount(){
    document.title = getLabel('513098','考勤打卡');
    this.init();
  }

  init = () => {
    const {signStore: store} = this.props;
    store.init();
  }

  redirectToOutsideSign = state => this.props.history.push({pathname: '/mapSign', state});
  
  render() {
    const {signStore: store} = this.props;

    if (store.baseInfo.showbutton == '0') {
      return (
        <CanNotAccess />
      )
    }

    return (
      <div className='hrm-sign'>
        <Header store={store} />
        <Content {...this.props} store={store} redirectToOutsideSign={this.redirectToOutsideSign}/>
        <Footer store={Footer} />
      </div>
    )
  }
}